package com.qls.web.modules.ht.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qls.core.entity.HtSellRoom;
import com.qls.web.common.utils.PageUtils;
import com.qls.web.common.utils.Query;
import com.qls.web.modules.ht.dao.HtLogicRoomDao;
import com.qls.web.modules.ht.service.HtLogicRoomService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * @author doyoung
 */
@Service("htLogicRoomService")
public class HtLogicRoomServiceImpl extends ServiceImpl<HtLogicRoomDao, HtSellRoom> implements HtLogicRoomService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Object roomCode = params.get("roomCode");
        IPage<HtSellRoom> page = this.page(
                new Query<HtSellRoom>().getPage(params),
                new QueryWrapper<HtSellRoom>().eq(roomCode != null && roomCode != "", "room_code", roomCode)
        );
        return new PageUtils(page);
    }

    @Override
    public List<HtSellRoom> getByHotelId(Long hotelId) {
        return baseMapper.getByHotelId(hotelId);
    }

    @Override
    public List<Long> queryRpCodesByGroup(Integer id) {
        return baseMapper.queryRpCodesByGroup(id);
    }
}